#!/bin/bash
spec=$1
/usr/bin/rsync -a -e "ssh -l root" ~/git/sa/system/rpmbuild/ 192.168.56.20:/root/rpmbuild --delete

ansible 192.168.56.20 -m shell -a "chown root:root -R /root/rpmbuild" 
ansible 192.168.56.20 -m shell -a "cd /root/rpmbuild/SPECS && rpmbuild -bb $spec" 

/usr/bin/rsync -a -e "ssh -l root" 192.168.56.20:/root/rpmbuild/RPMS/ ~/Downloads/RPMS

/usr/bin/rsync -a -e "ssh -l root" ~/Downloads/RPMS/ 192.168.56.21:/root/RPMS

ansible 192.168.56.21 -m shell -a "cd /root/RPMS/x86_64 && rpm -ivh *.rpm"
